package com.atguigu.spring.bean;

import com.sun.org.apache.bcel.internal.generic.GotoInstruction;
import org.springframework.beans.factory.FactoryBean;

/**
 * @author 孙志鹏
 * @create 2021-06-17 23:20
 */
public class MyBean implements FactoryBean<Dog> {

    /**
     * 返回对象的实例
     * @return
     * @throws Exception
     */
    @Override
    public Dog getObject() throws Exception {
        Dog dog = new Dog();
        dog.setName("旺旺");
        return dog;
    }

    /**
     * bean的类型
     * @return
     */
    @Override
    public Class<?> getObjectType() {
        return Dog.class;
    }

    /**
     * 是否单例
     * true是单例
     * false是非单例
     * @return
     */
    @Override
    public boolean isSingleton() {
        return true;
    }
}
